<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue_shangguigu.js"></script>

</head>

<body>
    <div id="root">
        <school><school />
        <hr/>
        <!-- <school2><school2/> -->
        <hr/>
        <p>{{msg}}</p>
        <commonman></commonman>
        
    </div>
</body>
<script>
		Vue.config.productionTip = false

    // 全局组件。相比局部组件，用的少一些
    const commonman = Vue.extend({
        template: `
        <div>
            <h2>{{manname}}</h2>
        </div>
        `,
        data() {
            return {
                manname: '通用人'
            }
        },
    })
    // 局部组件
    const school = Vue.extend({
        template: `
        <div>
            <p>{{schoolName}}</p>
            </div>
        `,
        data() {
            return {
                schoolName: '大学校'
            }
        },
    })
    const school2 = Vue.extend({
        template: `
        <div>
            <p>{{schoolName}}</p>
        </div>
        `,
        data() {
            return {
                schoolName: '大学校222'
            }
        },
    })
     // 注册全局组件
     Vue.component('commonman',commonman)
    new Vue({
        el: '#root',
        data() {
            return {
                msg:'hello'
            }
        },
        // 局部组件
        components: {
            school,
            school2,
        }
    })
</script>

</html>